//Copyright 2011 New York City 3D Community

//This file is part of New York City 3D.

//New York City 3D is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.

//New York City 3D is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with New York City 3D.  If not, see <http://www.gnu.org/licenses/>.

package nyc3d.settings;

public class Resolution {
    
    int width, height;

    public Resolution(int width, int height){
        this.width = width;
        this.height = height;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public static Resolution fromString(String resString){
        Resolution res;
        int xLoc = 0, width, height;

        xLoc = resString.indexOf("x");
        width = Integer.parseInt(resString.substring(0, xLoc));
        height = Integer.parseInt(resString.substring(xLoc + 1));

        res = new Resolution(width, height);

        return res;
    }

    public boolean equals(Resolution res2){
        return width == res2.width && height == res2.height;
    }

    @Override
    public String toString(){
        return width + "x" + height;
    }
}